
# # 生成静态库
# libmystdio.a: my_stdio.o my_string.o
# 	@ar -rc $@ $^
# 	@echo "build $^ to $@ ... done"
# %.o:%.c
# 	@gcc -c  $<
# 	@echo "compling $< to $@ ... done"
# .PHONY: clean # 清除
# clean:
# 	@rm -rf *.a *.o stdc*
# 	@echo "clean ... done" 
 
# .PHONY: output # 发布静态库
# output:
# 	@mkdir -p stdc/include
# 	@mkdir -p stdc/lib 
# 	@cp -f *.h stdc/include
# 	@cp -f *.a stdc/lib 
# 	@tar -czf stdc.tgz stdc # 打包
# 	@echo "output stdc ... done"


libmyc.so:mystdio.o mystring.o
	gcc -shared -o $@ $^
mystdio.o:mystdio.c
	gcc -fPIC -c $<
mystring.o:mystring.c
	gcc -fPIC -c $<

.PHONY:output
output:
	mkdir -p lib/include
	mkdir -p lib/mylib
	cp -f *.h lib/include
	cp -f *.so lib/mylib
	tar czf lib.tgz lib

.PHONY:clean
clean:
	rm -rf *.o libmyc.so lib lib.tgz
